<?


abstract class UICtrlBase extends CoderBase
{
	/**
	 * what's this
	 * 
	 * @access	public
	 * @return	array
	 */
	public function UICtrlBase( $sName )
	{
		JCAT_ASSERT::ASSERT_STRING($sName) ;
		$this->CoderBase($sName) ;
	}
	
	/**
	 * 初始化相关的 MVC 对象
	 * 
	 * @access	public
	 * @param	$aDoc		UICtrlDocBase	主文档
	 * @return	void
	 */
	public function Initialize( UICtrlDocBase $aDoc )
	{
		JCAT_ASSERT::ASSERT_INSTANCE($aDoc,'UICtrlDocBase') ;

		// 子 控制器 ----
		// 控件 基础信息
		$aSubController = new UICtrlBaseInfo($this,$aDoc) ;		
		$this->AddController($aSubController) ;
		
		// 控件数据校验器设定
		$aSubController = new DataVerifierSetting($this,$aDoc) ;		
		$this->AddController($aSubController) ;
		
		// 父类
		parent::Initialize($aDoc) ;
	}
	

	/**
	 * 
	 *
	 * @access	public
	 * @return	void
	 */
	public function MainRun($arrArgv=array())
	{
		parent::MainRun($arrArgv) ;
		
		// 数据校验 
		$aSubController = $this->GetController('DataVerifierSetting') ;
		JCAT_ASSERT::ASSERT_INSTANCE($aSubController,'DataVerifierSetting') ;
		$aSubController->MainRun() ;
	}
	
	/**
	 * what's this
	 * 
	 * @access	public
	 * @return	void
	 */
	public function SetPath( $sPath )
	{
		JCAT_ASSERT::ASSERT_PATH($sPath) ;
		
		$aUICtrl = $this->GetPathIUCtrl() ;
		$aUICtrl->SetPath($sPath) ;
	}

	/**
	 * what's this
	 * 
	 * @access	public
	 * @return	void
	 */
	public function GetPath()
	{
		$aUICtrl = $this->GetPathIUCtrl() ;
		$arrPaths = $aUICtrl->GetExchangeData(false) ;
		return $arrPaths[0] ;
	}
	
	/**
	 * what's this
	 * 
	 * @access	protected
	 * @return	JCAT_UIGtkCtrlFSChooser
	 */
	protected function GetPathIUCtrl()
	{
		// 设置 相关视图
		$aController = $this->GetController('UICtrlBaseInfo') ;
		JCAT_ASSERT::ASSERT_INSTANCE($aController,'UICtrlBaseInfo');
		
		$aView = $aController->GetView('UICtrlBaseInfoView') ;
		JCAT_ASSERT::ASSERT_INSTANCE($aView,'UICtrlBaseInfoView');
		
		$aUICtrl = $aView->GetUICtrl('UICtrlClassPath') ;
		JCAT_ASSERT::ASSERT_INSTANCE($aUICtrl,'JCAT_UIGtkCtrlFSChooser');
		
		return $aUICtrl ;
	}
	
	
	
	/**
	 * 设置控件类型
	 * 
	 * @access	public
	 * @return	array
	 */
	public function AddUICtrlKind($sKindName,$sClass)
	{
		JCAT_ASSERT::ASSERT_STRING($sKindName) ;
		JCAT_ASSERT::ASSERT_STRING($sClass) ;
		
		$aController = $this->GetController('UICtrlBaseInfo') ;
		JCAT_ASSERT::ASSERT_INSTANCE($aController,'UICtrlBaseInfo',JCAT_Language::Sentence('需要先调用 初始化方法 UICtrlBase::Initialize()'));
		
		$aView = $aController->GetView('UICtrlBaseInfoView') ;
		JCAT_ASSERT::ASSERT_INSTANCE($aView,'UICtrlBaseInfoView');
		
		$aUICtrl = $aView->GetUICtrl('UICtrlKind') ;
		JCAT_ASSERT::ASSERT_INSTANCE($aUICtrl,'JCAT_UIGtkCtrlSelect');
		
		$aUICtrl->AddOption($sKindName,$sClass) ;
	}

	

}

?>